﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace BussinessLayer
{
    public class tbldoanphi
    {
        DataLayer.Data odata = new DataLayer.Data();
        public void doanphi(int _id, int _thang,int _nam,int _sotien)
        {
            SqlParameter[] sp = new SqlParameter[4];
            sp[0] = new SqlParameter("@doanphi_id", _id);
            sp[1] = new SqlParameter("@thang", _thang);
            sp[2] = new SqlParameter("@nam", _nam);
            sp[3] = new SqlParameter("@sotien", _sotien);
            odata.proc_TS("tblDoanphi", sp);
        }
        public DataTable SelectAlldoanphi()
        {
            return odata.view_text("SELECT * FROM doanphi");
        }
        public DataTable SelectDPTheoThangNam(int thang, int nam)
        {
            return odata.view_text("select doanphi_id, sotien from doanphi where thang='" + thang + "' and nam='" + nam + "'");
        }

        public DataTable SelectDVDaNapDP(int _doanphiID)
        {
            return odata.view_text("SELECT * FROM doanvien_doanphi AS dvdp LEFT JOIN doanphi AS dp ON dvdp.doanphi_id=dp.doanphi_id WHERE dvdp.doanphi_id='" + _doanphiID + "'");
        }
       
    }
}
